package simple

// https://leetcode-cn.com/problems/transpose-matrix/
// 转置数组
// 直接遍历即可
// 时间复杂度: O(n * m)
func Transpose(matrix [][]int) [][]int {
	lenX, lenY := len(matrix), len(matrix[0])
	retArr := make([][]int, lenY)
	for y := 0; y < lenY; y++ {
		retArr[y] = make([]int, lenX)
		for x := 0; x < lenX; x++ {
			retArr[y][x] = matrix[x][y]
		}
	}
	return retArr
}
